<template>
    <svg-icon :id="id" :icon-class="element.data.url" class=""></svg-icon>
</template>

<script>
import register from '@/js/main/register.js';
import util from '@/js/util/util.js';
export default {
    props: {
        element: {
            type: Object
        },
        id: {
            type: String
        },
        mode: {
            type: Number
        }
    },
    data() {
        return {
            myChart: null
        };
    },
    created() {
        register.addComponent(this);
    },
    mounted() {
        if (this.mode === 1) {
            if (this.element.attribute.hasOwnProperty("pOption")) {
                return false;
            }
            let param = `__g.tools.showUIPanel(${this.element.data.type}, [200, 100]);`;
            if (this.element.data.label === '分析' && this.element.data.type.indexOf('UIPanelType') > -1) {
                param = `__g.tools.showUIPanel(${this.element.data.type}, [200, 100]);`
            }
            let elementEvent = {
                id: util.getID(),
                event: 'block',
                param: param,
                group: 1,
                action: 'click'
            };
            this.element.event.push(elementEvent);
        }
    },
    destroyed() {
        register.removeComponent(this);
    }
};
</script>

<style lang="scss" scoped>

</style>